package com.byfan.barter.jpa;

import com.byfan.barter.entity.Orders;
import org.hibernate.criterion.Order;

import java.util.List;

/**
 * @Author: FBY
 * @Description 订单的持久层
 * @Version 1.0
 * @Date: 2021/5/14 15:27
 */
public interface OrdersJpa extends BaseRepository<Orders,Integer>{

    List<Orders> findByFromOpenIdOrderByCreatTimeDesc(String fromOpenId);

    List<Orders> findByToOpenIdOrderByCreatTimeDesc(String toOpenId);

    List<Orders> findByFromOpenIdAndStatusOrderByCreatTimeDesc(String fromOpenId,String status);

    List<Orders> findByToOpenIdAndStatusOrderByCreatTimeDesc(String toOpenId,String status);

    /**
     * 查询剩余时间字段大于等于指定值的所有记录
     * @param remainingTime 指定剩余时间
     * @return
     */
    List<Orders> findAllByRemainingTimeGreaterThanEqual(Integer remainingTime);

}
